package mirfordevoservice.system.contasnt;

import publicPackage.item.Items;
import mirfordevoservice.config_entity.mapdesc.Map_ID;
import mirfordevoservice.config_entity.monster.Monster;
import mirfordevoservice.config_entity.skill.Skill;
import publicPackage.human.HumanData;
import publicPackage.human.Role;

import java.net.Socket;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;

/**
 * Created by Heart!
 *
 * @Author ZhangChaoJian
 * @Date 2018/3/13.20:14
 * Wants More Then Try Hard More!
 */
public interface GameConstant {
    /**
     * 在线人物会话
     */
    interface GameSession {
        Map<Socket, Long> ONLINE_ROLE_SESSION = new ConcurrentHashMap<>();//登陆玩家集合
        Map<Long, HumanData> ONLINE_HUMAN_SESSION = new ConcurrentHashMap<>();//在线角色集合
    }

    /**
     * 游戏内数据流 需要线程安全
     */
    interface GameDataStream {
        Map<Long, Role> ALL_ROLES = new ConcurrentHashMap<>();//ID-ROLE的MAP
        Map<String, Long> COUNT_ROLES = Collections.synchronizedMap(new TreeMap<>());//名字-ID的MAP
        Set<String> NAME_LIST = Collections.synchronizedSet(new HashSet<>());//已用名字集合

    }

    /**
     * 游戏内各类缓存常量集合
     */
    interface CacheCenter {
        /**
         * 协议配置
         */
        Map<String, Class> PROTOCOL_CONFIG_CACHE = new TreeMap<>();
        /**
         * 怪物,技能和地图配置
         */
        Map<String, String> MON_PICID_CACHE = new TreeMap<>();
        Map<String, Skill> SKILL_CACHE = new TreeMap<>();
        Map<String, Monster> MONSTER_CACHE = new TreeMap<>();
        Map<String, Map_ID> ID_TO_GET_MAP_NAME = new TreeMap<>();//ID对应的地图名字

        /**
         * 物品
         */
        Map<String, Items> ITEM_CACHE_MAP = new TreeMap<>();//物品配置数据缓存
        /**
         * 人物配置
         */
        Map<String, Map<String, Integer>> HUMAN_ALL_DATA = new TreeMap<>();//人物配置数据缓存
        /**
         * 经验表配置
         */
        Map<Integer, Long> HUMAN_EXP = new TreeMap<>();
        Map<Integer, Long> HERO_EXP = new TreeMap<>();
    }

    /**
     * 游戏内的正则表达式
     */
    interface GameRegex {
        String E_Mail_regEx = "[a-zA-Z_]{1,}[0-9]{0,}@(([a-zA-z0-9]-*){1,}\\.){1,3}[a-zA-z\\-]{1,}";//邮箱正则
        String PLAYER_NAME_REGEX = "^[\\u4e00-\\u9fa50-9A-Za-z][\\u4e00-\\u9fa5A-Za-z1-9_-]{1,10}$";//最少一个字符，最多10个
        String USER_NAME_REGEX = "^[A-Za-z][A-Za-z0-9_-]{1,20}$";//最少一个字符，最多20个//用户名正则
        String PASSWORD_REGEX = "^[A-Za-z][A-Za-z1-9_-]{6,20}$";//最少6个字符，最多20个//用户名正则
        String PHONE_NUMBER = "^((13[0-9])|(14[5,7,9])|(15([0-3]|[5-9]))|(17[0,1,3,5,6,7,8])|(18[0-9])|(19[8|9]))\\d{8}$";//电话正则
        String NUMBER_REGEX = "[0-9]{1,15}$";//数字的正则
        String MONGEN_REGEX = "^[\\u4e00-\\u9fa50-9A-Za-z]{1,10}$";//刷怪配置的信息
    }

    /**
     * 拾取等级
     */
    interface PickUpLevel {
        String[] LEVEL = {"10级", "20级", "30级", "40级", "50级", "60级", "70级", "80级", "90级", "100级", "110级", "120级"};
    }


    /**
     * 角色相关参数
     */
    interface HumanType {
        /**
         * 人物经验倍率设置
         */
        interface Exp {
            int RATE = 1;
            int KILL_MON_RATE = 2;
        }

        /**
         * 职业
         */
        interface Job {
            int WARRIOR = 1;
            int WIZARD = 2;
            int TAOIST = 3;
            int HUNTER = 4;
        }

        /**
         * 性别
         */
        interface Sex {
            int MALE = 1;
            int FEMALE = 2;
        }

        /**
         * 封禁与否
         */
        interface CanLogin {
            boolean LOGIN = true;
            boolean CAN_NOT_LOGIN = false;
        }
    }

    /**
     * 穿戴位置
     */
    interface EquipBoxPosition {
        byte BLESS_ONE = 1;
        byte BLESS_TWO = 2;
        byte MEDAL = 3;
        byte NECKLACE = 4;
        byte LEFT_HAND = 5;
        byte RIGHT_HAND = 6;
        byte LEFT_RING = 7;
        byte RIGHT_RING = 8;
        byte PHYLACTERY = 9;
        byte BELT = 10;
        byte SHOES = 11;
        byte STONE_ONE = 12;
        byte STONE_TWO = 13;
        byte HORSE = 14;
        //特殊
        byte CLOTH = 15;
        byte WEAPON = 16;
        byte HELMET = 17;
        byte MYSTERY_HET = 18;//斗笠
    }

    /**
     * 游戏安全设置
     */
    interface GameSafe {
        boolean OPEN_SAFETY_SAVING = true;//开启存档功能保护
    }

    /**
     * 物品种类
     */
    interface ItemType {
        int TRASH = -1;//废品
        int DRUG = 0;//药品类
        int BOX = 1;//宝箱类
        int BUFF_DRUG = 2;//药水BUFF
        int MEDAL = 3;//勋章
        int CLOTH_MAN = 4;//衣服男
        int CLOTH_WOMAN = 5;//衣服女
        int WEAPON = 6;//武器
        int HELMET = 7;//头盔
        int TITLE = 8;//称号
        int STROLL = 9;//卷轴
        int BOOK = 10;//技能书
        int MYSTERY_HET = 11;//斗笠
        byte BLESS_SOUL = 12;//神佑
        byte NECKLACE = 13;//项链
        byte HAND = 14;//手镯
        byte RING = 15;//戒指
        byte PHYLACTERY = 16;//护符
        byte BELT = 17;//腰带
        byte SHOES = 18;//鞋子
        byte STONE = 19;//宝石
        byte HORSE = 20;//马牌
        byte EXP_PACKAGE = 21;//经验球
    }
}
